package com.panopset.op;

/**
 * Abstract prompter, implemented by console, swing, or other user interfaces.
 * @author Karl Dinwiddie
 *
 */
public abstract class Prompter {

    /**
     * @return value from user.
     */
    protected abstract String get();

    /**
     * Prompt.
     */
    private final String prompt;

    /**
     * @return Prompt.
     */
    protected final String getPrompt() {
        return prompt;
    }

    /**
     * @param userPrompt User prompt.
     */
    public Prompter(final String userPrompt) {
        prompt = userPrompt;
    }

    @Override
    public final String toString() {
        return get();
    }
}
